﻿<UserControl x:Class="VisualRibbonEditor.WebResourceDialog"
			 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
			 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
			 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
			 xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
			 xmlns:avalonedit="http://icsharpcode.net/sharpdevelop/avalonedit"
			 mc:Ignorable="d" 
			 d:DesignHeight="400" d:DesignWidth="600" FontSize="12" KeyUp="WebResourceDialog_KeyUp" FocusManager.IsFocusScope="True">

	<Border BorderBrush="Black" BorderThickness="2">
		<Grid x:Name="LayoutRoot" Background="#fcfcfc"
				Width="{Binding ActualWidth,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}" 
				Height="{Binding ActualHeight,RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type Window}}}">
			<Grid.RowDefinitions>
				<RowDefinition Height="40" />
				<RowDefinition Height="30" />
				<RowDefinition Height="*" Name="MainRow" MinHeight="280" />
				<RowDefinition Height="40" />
			</Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="300" />
				<ColumnDefinition Name="PreviewColumn" MinWidth="185" />
			</Grid.ColumnDefinitions>
			<Border Background="#eeeeee" BorderThickness="0,0,0,1" BorderBrush="#aaaaaa" Grid.ColumnSpan="2" Grid.Row="0" Grid.Column="0">
				<TextBlock Text="Web Resources" FontSize="14" Margin="10" />
			</Border>
			<TextBlock Name="QuickSearchLabel" Text="Quick Search" Grid.Row="1" Grid.Column="0" VerticalAlignment="Bottom" Margin="14 0 5 1" Foreground="Silver" Opacity="0.5" FontStyle="Italic" />
			<TextBox Name="QuickSearch" Grid.Row="1" Grid.Column="0" Margin="10 0 5 0" Background="Transparent" VerticalAlignment="Bottom" KeyUp="QuickSearch_KeyUp" Text="" Width="Auto"/>
			<ListBox SelectionChanged="WebResources_SelectionChanged" Name="WebResources" DockPanel.Dock="Bottom"
								Grid.Row="2" Grid.Column="0" Margin="10 -1 5 10"
								ScrollViewer.VerticalScrollBarVisibility="Auto" ScrollViewer.HorizontalScrollBarVisibility="Auto" 
								Height="Auto" Width="Auto" SelectionMode="Single" VerticalAlignment="Stretch" HorizontalAlignment="Stretch" />
			<GridSplitter Name="GridSplitter" Grid.Column="0" Grid.Row="2" Margin="0 0 5 0" HorizontalAlignment="Right" ShowsPreview="True" VerticalAlignment="Stretch" Width="5"/>
			<TextBlock Name="Loading" Grid.Row="2" Grid.Column="0" HorizontalAlignment="Center" VerticalAlignment="Center" Text="Just a moment..."/>

			<TextBlock Name="Preview_NotAvailable" Grid.Row="2" Grid.Column="1" Text="Preview not available" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed" />
			<ProgressBar Name="Preview_Loading" Grid.Row="2" Grid.Column="1" HorizontalAlignment="Center" VerticalAlignment="Center" Width="250" Height="8" Foreground="{DynamicResource {x:Static SystemColors.ActiveCaptionBrushKey}}" Visibility="Collapsed"/>
			<!-- Image preview controls -->
			<StackPanel Grid.Row="2" Grid.Column="1" VerticalAlignment="Center" HorizontalAlignment="Center">
				<Image Name="Preview_Image" Margin="0 0 10 0" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed" />
				<TextBlock Name="Preview_ImageSize" Text="" Margin="0,5,10,0" HorizontalAlignment="Center" VerticalAlignment="Center" Visibility="Collapsed" />
			</StackPanel>
			<!-- Editor preview controls -->
			<CheckBox Name="WordWrap" Grid.Row="1" Visibility="Collapsed" Grid.Column="1" Content="Word Wrap" Checked="WordWrap_OnChange" Unchecked="WordWrap_OnChange" IsChecked="False" 
							Margin="5 0 0 0" HorizontalAlignment="Left" VerticalAlignment="Center"/>
			<avalonedit:TextEditor 
							Visibility="Collapsed" 
							Grid.Row="2"
							Grid.Column="1"
							SyntaxHighlighting="JavaScript"
							ShowLineNumbers="True" 
							Margin="0 0 10 10"
							Name="Preview_Editor"
							FontFamily="Courier New"
							FontSize="13" 
							IsReadOnly="True"
							VerticalScrollBarVisibility="Visible" 
							HorizontalScrollBarVisibility="Auto"
							ContextMenuOpening="ContextMenu_ContextMenuOpening">
				<avalonedit:TextEditor.ContextMenu>
					<ContextMenu>
						<MenuItem Header="Copy" Name="MenuItem_Copy" IsEnabled="False" Command="ApplicationCommands.Copy" />
						<MenuItem Header="Select all" IsEnabled="True" Command="ApplicationCommands.SelectAll" />
					</ContextMenu>
				</avalonedit:TextEditor.ContextMenu>
			</avalonedit:TextEditor>
			<Border Grid.Row="3" Grid.ColumnSpan="2" BorderThickness="0,1,0,0" BorderBrush="#aaaaaa" >
				<StackPanel Orientation="Horizontal" HorizontalAlignment="Right">
					<Button Name="OKButton" Content="OK" Height="22" MinWidth="65" Margin="10,0,0,0" IsEnabled="False" Click="OKButton_Click" />
					<Button Name="CancelButton" Content="Cancel" Height="22" MinWidth="65" Margin="10,0,10,0" Click="CancelButton_Click" />
				</StackPanel>
			</Border>
		</Grid>
	</Border>
</UserControl>